<?php

class JSCasts_URI
{
	private $scheme;
	private $hierarchy;
	private $query;
	private $fragment;
	
	public function __toString()
	{
		$out = $this->scheme . $this->hierarchy . $this->query;
		
		if (!empty($this->fragment)) {
			$out .= '#' . $this->fragment;
		}
	}
	
	// FIXME: This won't work... public function scheme(JSCasts_URI_Scheme $newValue = false)
	public function scheme($newValue)
	{
		return $this->setAndReturn('scheme', $newValue);
	}
	
	public function hierarchy($newValue)
	{
		return $this->setAndReturn('hierarchy', $newValue);
	}
	
	public function query($newValue)
	{
		return $this->setAndReturn('query', $newValue);
	}
	
	public function query($newValue)
	{
		return $this->setAndReturn('query', $newValue);
	}
}